UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w7RCz424+xmKhwB0+g3U5F+M04eiD47E2tXqxBtlYLk=' 
WHERE 
  key_id = 'fa1306d9db4d9e749d74a66f7b08496cc0edef7114039ba09e87466d20c6c523' 
  AND (
    token = 'w7RCz424+xmKhwB0+g3U5F+M04eiD47E2tXqxBtlYLk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055