UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '239aZm7FfmcJwljVmy34dgbbpHUgT73/kUNwBg8dIbw=' 
WHERE 
  key_id = 'f935b8fbdc274883b59d09bb77a9b955c0bf43350337bc7326db69a51de9c5ee' 
  AND (
    token = '239aZm7FfmcJwljVmy34dgbbpHUgT73/kUNwBg8dIbw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048