UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C1230r375Ky44uQqk3gQ4OMn2YN0AojkKf7dMaUuDr0=' 
WHERE 
  key_id = '3bb56dc686900753aa27ca8e72c2b6e7ef559a9780f276df365c6bd9b0498581' 
  AND (
    token = 'C1230r375Ky44uQqk3gQ4OMn2YN0AojkKf7dMaUuDr0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020