UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XZxmcBl2MAy9Bg5YvJOTl1Ev2j9QKyKcPwSPBbgLj3M=' 
WHERE 
  key_id = 'a6e0ee87ffb877343102e3ad804bc73e6e375aeb3d2b1b641baddbb23d267375' 
  AND (
    token = 'XZxmcBl2MAy9Bg5YvJOTl1Ev2j9QKyKcPwSPBbgLj3M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034