UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6UEgay5w0uY10+TukhP0IOX8I9bi7A1g5WeyvNZE2tk=' 
WHERE 
  key_id = '408a1377c186172370415cdfd1a9e833378c50475a4c1dc92eef77b044085490' 
  AND (
    token = '6UEgay5w0uY10+TukhP0IOX8I9bi7A1g5WeyvNZE2tk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046