UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZT+ekWyZa8FZb78u762iPJ+GzW8liHw2vpvd98J167M=' 
WHERE 
  key_id = '8363b27fe48c486ff399fd5029486103f25b42a640f3cdecc76c6cef555ed797' 
  AND (
    token = 'ZT+ekWyZa8FZb78u762iPJ+GzW8liHw2vpvd98J167M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043