UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NAmk1ph5QfjJWR7M9Wik9qmG0EbrM38HaJ5mTxkvDMw=' 
WHERE 
  key_id = 'a02d88f6baf94081bdde6b68686eef514d58698027508cb0a1ade12af6afa113' 
  AND (
    token = 'NAmk1ph5QfjJWR7M9Wik9qmG0EbrM38HaJ5mTxkvDMw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037