UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ydD1ETcbaDX6wcfhZA5peeWZqdnr0lm91uGWF2qa/f8=' 
WHERE 
  key_id = '57025e4d5085ff256fbe97999332aabd99d6f15b9fcb4a00461a0436d070426f' 
  AND (
    token = 'ydD1ETcbaDX6wcfhZA5peeWZqdnr0lm91uGWF2qa/f8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030