UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W8d+vdHo4pnkufciqbFf4rWb6KY7T1GXB0t0gtmAEKo=' 
WHERE 
  key_id = '9dce40acbb21677f87d1f6274b63c5d8047dfec301c3274c478c18fc7b683773' 
  AND (
    token = 'W8d+vdHo4pnkufciqbFf4rWb6KY7T1GXB0t0gtmAEKo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042