UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gAoIE6HQGFLB4DQEGioU8kJYuP2ecgCC+TuuBNinu+M=' 
WHERE 
  key_id = 'a9f063e9580c4646bb0d5824ea54d7401a8dfda7a9401d14d5620bb294565780' 
  AND (
    token = 'gAoIE6HQGFLB4DQEGioU8kJYuP2ecgCC+TuuBNinu+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036