UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pta2sNoTW2Z0+O/5glDXumOZwWSyvn37uOu1BqwSRrg=' 
WHERE 
  key_id = '7597759aae1f3755889fea4d0cd816070e70368ccf476a76e59b19e6d1499a9a' 
  AND (
    token = 'pta2sNoTW2Z0+O/5glDXumOZwWSyvn37uOu1BqwSRrg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051