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

Query time 0.00032