UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tuyKEdhFpk+IAJuMRZczuOfGM12Hf1SSfKT4vC6cPns=' 
WHERE 
  key_id = '798ac80fe0367a2a39a5b34a8c60e51fc081de55999fbe0a2d87e9f00450b304' 
  AND (
    token = 'tuyKEdhFpk+IAJuMRZczuOfGM12Hf1SSfKT4vC6cPns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041