UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H1KtNZmc8zuLJQRNrg90YjjiB6lodBeARLrUKzzJ9CA=' 
WHERE 
  key_id = '8fe76458943272e41361a3a0b6f05f22b685bfd149a90df0431251293e9ded37' 
  AND (
    token = 'H1KtNZmc8zuLJQRNrg90YjjiB6lodBeARLrUKzzJ9CA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047