UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'twyq/Gv2qMMkkmNrOC5NxRcBIoEnWtHXxTpqs6YIvsk=' 
WHERE 
  key_id = 'f5232a443ce02e53e743e2fa2063014332331479c8e2ae334c2df01de27251eb' 
  AND (
    token = 'twyq/Gv2qMMkkmNrOC5NxRcBIoEnWtHXxTpqs6YIvsk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00079