UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6wtf/yg1Uc6NvI96dBvwhywHJhJ73jgxL4AEO9MNSQo=' 
WHERE 
  key_id = '54d9aa14f1c2464793d55299463323316231a2c0b04994a556f651be946e834f' 
  AND (
    token = '6wtf/yg1Uc6NvI96dBvwhywHJhJ73jgxL4AEO9MNSQo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047