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

Query time 0.00025