UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P5/s5bX71bA/rhABz9083oT28kuMKhWsOsJY7zQJX7o=' 
WHERE 
  key_id = '3f11d97b8acb954ff5dfeac19ab863704687f103c4e87d8ab258e878f04e0cd0' 
  AND (
    token = 'P5/s5bX71bA/rhABz9083oT28kuMKhWsOsJY7zQJX7o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048