UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ah6YGmyjFD6ug8ZDd0N2gP1PETjYiucUU1h/jYIlAJU=' 
WHERE 
  key_id = 'a04bfd14819030d948b69375322cb600ebf421b81d5030abf3970b1e6c785959' 
  AND (
    token = 'Ah6YGmyjFD6ug8ZDd0N2gP1PETjYiucUU1h/jYIlAJU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024