UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8y6V5uRijeTGIvTAyz4KQFO9FHHRsHN/hNtotNazXvo=' 
WHERE 
  key_id = 'b8c6b5720a60cd481fd973b590f584e12e29697b71945a79c870133289bd27ec' 
  AND (
    token = '8y6V5uRijeTGIvTAyz4KQFO9FHHRsHN/hNtotNazXvo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037