UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm+nAyvKN9l4njW/xF4br6aG8g4SYh16O4G0TZ0BYc0E=' 
WHERE 
  key_id = '1b2417a21042991bd837789ac5f152a1e084284fb48bafec02a1734a0c286c04' 
  AND (
    token = 'm+nAyvKN9l4njW/xF4br6aG8g4SYh16O4G0TZ0BYc0E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018