UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AlsqHZpYeMsqtHzGdonb2ssIJTXmBpYoA8bg0lpEfeY=' 
WHERE 
  key_id = '51d6885f2445022e5c65f0b7c1c7fe6d99efdbc30c2fb4494e82a63ab418e6ad' 
  AND (
    token = 'AlsqHZpYeMsqtHzGdonb2ssIJTXmBpYoA8bg0lpEfeY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026