UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+fBlbe3HPuzSmPZEv1JZG/AKf2NPEx+VQBGhpFOQ5Ng=' 
WHERE 
  key_id = '709df1b58d7c77231a757757e2c5056897814e53725800917df7022d0f3157a7' 
  AND (
    token = '+fBlbe3HPuzSmPZEv1JZG/AKf2NPEx+VQBGhpFOQ5Ng=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025