UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ofIl4/sBq1rtqmDSiNOBS4D0LEp5Z0LWvHZo4FxZrro=' 
WHERE 
  key_id = '50ed6171fb56947454352d46685525374cc7861aa5c458b83498bdfda855d32a' 
  AND (
    token = 'ofIl4/sBq1rtqmDSiNOBS4D0LEp5Z0LWvHZo4FxZrro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021