UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T5yi5q1bcAN2XJB5PpD+uT/B83J8RUyQ2n7p+ubs2KA=' 
WHERE 
  key_id = 'e28f7cc62ae94a293e651129af86850c10e9195d6762f92d2e5e2a887c5459ec' 
  AND (
    token = 'T5yi5q1bcAN2XJB5PpD+uT/B83J8RUyQ2n7p+ubs2KA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041