UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hdE4r/BJ1SkNUgOkT4bgvGeRIBpkMoRoDDXi39Yryyk=' 
WHERE 
  key_id = '4eaf0dd7fd1d6936a00306f9c0ab190e2956a3c4bf3ce39b940cc556ee98bdbf' 
  AND (
    token = 'hdE4r/BJ1SkNUgOkT4bgvGeRIBpkMoRoDDXi39Yryyk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036