UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hrA0vsIkNgp7b5/sFQqVePpmtJjiDNo7/ShYymLtg6Q=' 
WHERE 
  key_id = '2566dc9c629c0df8f936360cc2bac9e92c43deac4fd832fbdd984c373d402f97' 
  AND (
    token = 'hrA0vsIkNgp7b5/sFQqVePpmtJjiDNo7/ShYymLtg6Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038