UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S/ATQwmpYrMudumwc8LTW9Lv7MaUZZjLaxetkTVJMBk=' 
WHERE 
  key_id = 'a786d1b8ad33332e2f7e0a5d7f62938a49c0b8ecf96a1e7766abccdb84017eac' 
  AND (
    token = 'S/ATQwmpYrMudumwc8LTW9Lv7MaUZZjLaxetkTVJMBk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041